<?php

require_once APP_DIR . '/models/Template.php';

class Templates
{
	/**
	 * An gateway to retrieve instances of the Template active record object.
	 *
	 * @var Zend_Db_ActiveRecord_Gateway
	 */
	protected $templates;
	
	
	public function __construct()
	{
		$this->templates = new Zend_Db_ActiveRecord_Gateway('Template');
	}
	
	
	public function loadTemplates() {
		$select = $this->templates->select();
		return $this->templates->fetchAll($select);
	}
	
	public function saveTemplate($template)
	{
		$template = new Template($template);
		$template->save();
		return $template;
	}
	
	public function deleteTemplate($templateId)
	{
		$this->templates->delete($templateId);
	}
	
}
